package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_UPDATE_AUTO_EVENT_SWITCH, desc = "修改自动处理开关")
public class CrossUpdateAutoEventSwitchCmd extends CrossCommand {

    private List<Integer> openSwitchList = null;
    private int activityId;
    private long userId;
    private long serverId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossUpdateAutoEventSwitchReqMsg reqMsg = HuaShiGangProto.CrossUpdateAutoEventSwitchReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        openSwitchList = reqMsg.getOpenSwitchTypeList();
        serverId = reqMsg.getServerId();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.updateOpenSwitch(activityId, serverId, userId, openSwitchList);
    }

    @Override
    public void sendData() {

    }
}
